OLD_ID=${BUILD_ID}
# 注意：1 这里要改
BUILD_ID=dontKillMe
echo "begin"

/usr/local/bin/pm2 delete jenkins-yarn

/usr/local/bin/yarn config set registry 'https://registry.npm.taobao.org'
/usr/local/bin/yarn install
/usr/local/bin/yarn build

rm -rf /home/runner/dist/*
cp -r dist /home/runner/dist

sed -i "4c const host = 'http://39.98.160.76:1027/'" vue.config.js
sed -i "78c port: 1026," vue.config.js

nohup /usr/local/bin/pm2 start /usr/local/bin/yarn --name jenkins-yarn -- serve &
sleep 10
echo "finish"

BUILD_ID=${OLD_ID}
